<?php
class Memcachedhelper
{
    private $config = array('host'=>'127.0.0.1','port'=>'11211');
    private $memcache = NULL;
    public function __construct()
    {
        $this->memcache = new Memcache;
        $this->memcache->connect($this->config['host'], $this->config['port']) or die("Could not connect");
    }

    public function get($key)
    {
        return $this->memcache->get($key);
    }
    public function set($key,$val,$expire=3600)
    {
        return $this->memcache->set($key,$val,MEMCACHE_COMPRESSED,$expire);
    }

    public function flush()
    {
        $this->memcache->flush();
    }
    public function increment($key,$incr=1)
    {
        return $this->memcache->increment($key,$incr);
    }
    public function decrement ($key,$decr=1)
    {
        return $this->memcache->decrement ($key,$decr);
    }
    public function delete($key)
    {
        return $this->memcache->delete($key,0);
    }
   
//    $version = $memcache->getVersion();
}
?>